Update README.md
[BattleCats.git] / Assets / Scripts / UI Scripts / PageManager.cs
blob99dd4bbe60478351e29eaedd348e32cb3fd1c585
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 using UnityEngine.UI;
6 public class PageManager : MonoBehaviour {
8 public GameObject[] Pages;
10 public GameObject left;
12 public GameObject right;
14 private int pageCounter;
16 private int PageMax = 1;
18 void Start()
20 pageCounter = 0;
21 PageMax = Pages.Length;
22 left.SetActive(false);
25 void Update()
27 foreach (GameObject gameObject in Pages)
29 gameObject.SetActive(false);
31 if (Pages[pageCounter])
33 Pages[pageCounter].SetActive(true);
37 public void LeftPage()
39 pageCounter = (pageCounter - 1) % PageMax;
40 print(pageCounter);
41 if (pageCounter < 0)
43 pageCounter += PageMax;
47 public void RightPage()
49 pageCounter = (pageCounter + 1) % PageMax;
50 print(pageCounter);
51 if (left.activeSelf == false)
53 left.SetActive(true);